/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src;

import frontend.MiddlewareFrontend;
import java.io.FileInputStream;
import java.util.Properties;
import org.apache.thrift.server.TNonblockingServer;
import org.apache.thrift.server.TServer;
import org.apache.thrift.transport.TNonblockingServerSocket;
import org.apache.thrift.transport.TNonblockingServerTransport;
import org.eclipse.jetty.server.Server;

/**
 *
 * @author chanhlt
 */
public class main {

    public static void main(String[] args) throws InterruptedException, Exception {

//        Server server=new Server(8080);
//        server.setHandler(new hellohandler());
//        server.start();
//        server.join();

         Properties pro=new Properties();
        pro.load(new FileInputStream("src/conf/config.ini"));
        
        int port=Integer.parseInt(pro.getProperty("port_listen"));
        
        TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(port);
        frontend.MiddlewareFrontend.Processor processor = 
                new MiddlewareFrontend.Processor(new FrontendHandler());

        TServer server = new TNonblockingServer(new TNonblockingServer.Args(serverTransport).
                processor(processor));
        System.out.println("Starting server on port "+port+" ...");
        server.serve();

    }
}
